package com.cos.shop.common;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000121668667";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQCedHLsGsPRl+BzckGNpit9KcDux/rtAGLKFXNMIjK6HJsTn5MSrwmT+wDmsU5a28bnUKT+QJAHvYQQLYTrB5VbWw2sAIKFIe5q/kNs+VnR9vC5kObripLulOC65YpsD9zu6JWAziCFlF+tRb3aoT0b0mfS4uWKjQGadXIr1Bve4+ka7fJ3zUS7Ts9nznEPtnb2YEEFFgsEt3O+vSfFTTA2PSlg6iJF8rWAo+SZDl3ow+Q8xNLkf6SQsGYfJ9VV/nB1ZPGsio5snllPNZsNGGMqCMhA80XK3ULnCECloiIWb32UUrvVWgCB7PPyAZ/W9cQfEtf1P0W+e0/dnNroRsFZAgMBAAECggEBAIL6pShvs2AkV/91+aP6MMakZfu7SLrx77c15fmP5ziafsHIzUzLbXJqMEOBWtCWDSOWMNyOR8BuMqUgy1dwDFDYwkNkpH8iHi9JADkrIMkDg9cQZSFcibo3TFCRf0t2DV1a2oH/YTip/jB/jsETOS0vTm0u6ykNB79Cx95c1bD2jHV80LljqQp7DhmL2kamBtyG3XZO29MawF31Ebv3PM5f6P0KeTuIj0x/x9YpvSbo3xjyyuQTGVZ9JUUvc0k73+8r0m4ozdyW8cH5IduavwEsKdpfILm9tm8DKUpQIxyWN0+rEefMTG0uqhszDX3Z5yOFx5vFlSFacW16B3AA4gECgYEA1N8SZhUdDa0lirj298BIyq/PDkI2wu9VFD3kKmhP4d75pB7TXYCh3JpnxY25TZdkNTTD1UFR1+fXgDZcfDezLDerUq4lwmMxqiHK3wAitYkMKY93rE8Rq8vSPai2bl/J0mA1Ul7p+ZEcyBmJ80YgxBZSixIXoqQ+AZuhr7+oIcECgYEAvo75lB2ZJbnSrHMZ0nh1maA1Wf8/62Qa940IatOv8IZ871RI+N2ifgViuR43wQr3iAvAdW6aFuG9wCoW2zTISn9iPLS+f4+ADr+UjpPQ58vySiPrBid0lOfMYP37YSnKIv+EY7n0vpu83HEjAJGIxrchh2p/9/EHjsgO9uv11ZkCgYEAzanwBryjY1FEEjD+OwOF0H3nWGlUqyW8V2Asj2RUuW9KVeyKXa4ntBFh7RYuT+7SnC0sf18qiaSvKmpbFJBkBXaLichDJvnbQ/p+HNHutuF/5K99+fYypn6302arSxw0y5K0Ma8N81bmLdWu2GGKyqiee0qxlyuD1N3eawSKloECgYEAuJ5AgxWh+IDt8RGapOT72pjy13yKav4Tel7zFrx8qqVBiYW5JRNliH6jRQJXtflwFCh+j8dWFnEiq3ibqEic/EAp5vKd1Wwr/x3xSalALjLTTK072DyFoHZq9lVbJKmeIwY3N39D9R9hfJlH9hcJ0qw+Gbo+vPKSBe0hQm0dQZECgYEAr7yARiD3hEkoDfGriHhTwLpkuCenf91ht1DD1qVmeqHw5D2xEVIIRL+/KQiH/zQd9PA9qlGew1/syi0nkjeScrptO/tAc54HNorNzxdDZAjs8QdLKu7d9MGhsYKiqT1NTaNDZg7KDmoPRr1ZSrhYoHwqJMW3sN++Pp/AlGm7Af4=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApagMW2QZ53Dch0Vxw36c3r1gi1Y9L8MMvZEWx5rSihQqGSegf6mYXeP4YcgVuTW0mT3TBXEa17SoMxp5nLQvgJMsOTLGcG1KEbPGeabSV43obQ81z7kj2pSDDmDjEjUgxP3SOCguf4FldjPSYgyzzv3jG5C8eW1yk96u5y+jCv6PJ1oMKpR98LgRf6WZCF7ud38me2UXbPvKK+f+Q8xEA5pZ0Xv8WZe0E32jNfUp2WNPF2uFpzKZ3LnPBA9da48b6m+YzKqmh5lD6KlX1dyvVqWwkklleX80aarx0onwnsWOv7dq5Og2Xn3V5JTuqsQ2EiFBnVsi72sTnFUYqOMBMQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "F:\\alipay";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

